package View;

import java.util.*;
import java.io.*;

class WriteToPropertiesFile
{
    PrintWriter output = null;
    public  void writeToFile(HashMap map,String fileName) throws Exception{
        Properties properties = new Properties();
        Set set = map.keySet();
        Iterator itr = set.iterator();
        while(itr.hasNext()){
            String key = (String)itr.next();
            String value = (String) map.get(key);
            properties.setProperty(key, value);
        }

        //We have all the properties, now write them to the file.
        //The second argument is optional. You can use it to identify the file.
        properties.store(new FileOutputStream(fileName),"Java properties test");

        //To keep this example simple, I did not include any exception handling
        //code, but in your application you might want to handle exceptions here
        //according to your requirements.

    }
 }